package com.mmall.product.controller;

import com.mmall.common.base.ServerResponse;
import com.mmall.product.service.ProductSkuService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * sku
 *
 * @author gg
 * @version ProductSkuController.java, v 0.1 2019-05-05 19:04 gg
 */
@RestController
@RequestMapping("/sku/")
public class ProductSkuController {

    @Resource
    private ProductSkuService productSkuService;

    /**
     * 根据商品id查询 sku列表
     *
     * @param productId 商品id
     * @return ServerResponse
     */
    @PostMapping("getSkuListByProductId/{productId}")
    public ServerResponse getSkuListByProductId(@PathVariable Long productId) {
        return ServerResponse.createBySuccess(productSkuService.getSkuListByProductId(productId));
    }

}